<?php

namespace app\index\controller\paymentcallback;

use app\index\service\payments\TtpayPaymentService;
use app\index\service\payments\WxpayPaymentService;
use think\APP;
use think\Request;

/**
 * 抖音支付回调
 * Class Ttpay
 * @package app\index\controller\paymentcallback
 */
class Ttpay
{
    /**
     * 微信支付回调
     */
    public function index(Request $request)
    {
        $result = $this->getTtpayPaymentService()->payCallback($request);
        return json($result);
    }

    /**
     * 微信退款回调
     */
    public function refund(Request $request)
    {
        $result = $this->getTtpayPaymentService()->refundCallback($request);
        return json($result);
    }

    private function getTtpayPaymentService(): TtpayPaymentService
    {
        return \app(TtpayPaymentService::class);
    }

}
